<!doctype html>
<html lang="en" class="feedback">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>问题反馈</title>
		<link rel="stylesheet" type="text/css" href="../../css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="../../css/feedback.css" />
	</head>

	<body id="app">
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<button @tap='submit' id="submit" class="mui-btn mui-btn-blue mui-btn-link mui-pull-right">添加</button>
			<h1 class="mui-title">{{replyUserName?'回复 '+replyUserName:'回复评论'}}</h1>
		</header>
		<div class="mui-content">
			<div class="mui-content-padded">
				<div class="mui-inline">回复内容</div>
			</div>
			<div class="row mui-input-row">
				<textarea id='content' class="mui-input-clear question" placeholder="请输入你的回复..."></textarea>
			</div>
		</div>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/mui-extend.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/app.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<!--<script src="js/feedback.js" type="text/javascript" charset="utf-8"></script>-->
		<script type="text/javascript">
			mui.init();
			mui('.mui-scroll-wrapper').scroll();
			
			var vm = new Vue({
				el:'#app',
				data:{
					aid:'',
					replyUserID: 0,
					replyUserName: '',
				},
				ready:function () {
					var me  = this;
					mui.plusReady(function () {
						var current = plus.webview.currentWebview();
						me.aid=current.aid;
						me.replyUserID = current.replyUserID || 0;
						me.replyUserName = current.replyUserName;
//						if(!me.aid || !me.replyUserID || !me.replyUserName){
//							console.log(me.aid+" "+me.replyUserID+' '+me.replyUserName);
//						}
						showPage(current);
					})
					
				},
				methods:{
					submit:function () {
						var me = this;
						var content = document.getElementById("content");
						if(tool.isEmptyVal(content.value)){
							mui.toast('请填写内容');
							return;
						}
						
						var current = plus.webview.currentWebview();
//						console.log(me.replyUserID);
						ajax.post(api.circle.addComment,{AnswerID: me.aid, Content:content.value, ReplyUserID:me.replyUserID},function () {
							mui.fire(current.opener(),'reloadComments');
							current.close();
						},true);
					},
				}
			});
		</script>
	</body>

</html>